/*
 * @userName: 湫之恋
 * @Author: Seven
 * @Date: 2020-06-30 14:09:08
 * @LastEditors: Seven
 * @LastEditTime: 2020-07-01 16:18:43
 */
import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  //   登录页面
  {
    path: '/',  //商家管理员和超管
    name: 'login',
    component: () => import("../views/login/login.vue"),
  },
    {
        path: '/admin',  //商家管理员和超管
        name: 'admin',
        component: () => import("../views/admin/adminIndex.vue"),
        // beforeEnter(to,from,next){
        //     // 登录守卫
        //     if(localStorage.getItem('id')){
        //       next()
        //     }else{
        //       alert('请登录!')
        //       next('/')
        //     }
        //  },
    children: [
      {
        path: 'index',  //管理主界面
        name: 'index',
        component: () => import("../components/Index.vue"),
        children: [
          {
            // 评价
            path: 'estimate',
            name: 'estimate',
            component: () => import("../components/estimate/estimate.vue"),
          },
          // 评价图表
          {
            path: 'estimateChart',
            name: 'estimateChart',
            component: () => import("../components/estimate/estimateChart.vue"),
          },
          // 订单
           // 订单列表
          {
            path: 'order',
            name: 'order',
            component: () => import("../components/order/order.vue"),
          },
          //订单详情
          {
            path: 'orderDeatil/:_id', 
            name: 'orderDeatil',
            component: () => import("../components/order/orderDetail"),
          },
          {
            path: 'carlist',//车辆列表
            name: 'carlist',
            component: () => import('../components/car/carlist.vue'),
          },
          {
            path: 'carcheck',//审核车辆列表
            name: 'carcheck',
            component: () => import('../components/car/carcheck.vue'),
          },
          {
            path: 'AdminList',  //管理员列表界面
            name: 'AdminList',
            component: () => import("../components/admin/AdminList.vue"),
          },
          {
            path: 'AddAdmin',  //管理员添加界面
            name: 'AddAdmin',
            component: () => import("../components/admin/AddAdmin.vue"),
          },
          // 用户
          {
            path: 'lessorsUser',  //出租方
            name: 'lessorsUser',
            component: () => import("../components/user/LessorsUser.vue"),
          },
          //租赁方
          {
            path: 'hireList', 
            name: 'hireList',
            component: () => import("../components/user/hireList.vue"),
          },
          //身份审核
          {
            path: 'audit', 
            name: 'audit',
            component: () => import("../components/user/Audit.vue"),
          },
        ]
      },
    ]
  },
  // 买家
  // {
  //   path: '/user', 
  //   name: 'userIndex',
  //   component: () => import('../views/userIndex.vue'),
  //   children: [

  //   ]
  // }
]

const router = new VueRouter({
  routes
})

export default router
